package com.wss.module.main.ui.page.adapter;

import com.orhanobut.logger.Logger;
import com.wss.common.base.adapter.BaseListAdapter;
import com.wss.common.base.adapter.listener.OnListItemClickListener;
import com.wss.common.base.adapter.superadapter.SuperViewHolder;
import com.wss.common.utils.ToastUtils;
import com.wss.common.widget.SwipeItemLayout;
import com.wss.module.main.ResourceTable;
import ohos.app.Context;
import org.jetbrains.annotations.NotNull;

import java.util.List;

public class SlewedAdapter extends BaseListAdapter<String> {


    /**
     * 常规列表重写该方法
     *
     * @param context     context
     * @param mData        数据源
     */
    public SlewedAdapter(Context context, List<String> mData) {
        super(context,
                mData,
                ResourceTable.Layout_main_item_of_slewed,
                null);
    }

    @Override
    public void onBindData(@NotNull SuperViewHolder holder, int layoutPosition, @NotNull String data) {
        holder.setText(ResourceTable.Id_tv_text, data);
        SwipeItemLayout swipeItemLayout = holder.findViewById(ResourceTable.Id_swipe_layout);
//        holder.setOnClickListener(ResourceTable.Id_tv_ignore, v -> {
//            swipeItemLayout.close();
//            ToastUtils.show("忽略");
//        });
//        holder.setOnClickListener(ResourceTable.Id_tv_delete, v -> {
//            swipeItemLayout.close();
//            ToastUtils.show("删除");
//        });
//        swipeItemLayout.setOnItemSwipeListener(new SwipeItemLayout.OnItemSwipeListener() {
//            @Override
//            public void onItemSwipe(boolean isOpen) {
//                Logger.e("打开状态：" + isOpen);
//            }
//        });
    }
}
